<?
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../../../config.php");
include_once("/../../../../common/module/checkA.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
    <!--kindeditor编辑器-->
    <?php include_once(TASK_PATH_.'/mod-nkeditor.php'); ?>
</head>
<style>
    html{
        background: #fff;
    }
    #content{
        margin: 0;
    }
    .detail-box{
        
        margin: 0px 0 70px 0;
    }
    .detail-box .function{
        margin-left: 0;
    }
</style>
<body>
<div id="content">
    <?php $page_title='新增批量任务';?>
    <?php include ROOT_PATH_.'/controller/common/module/mod-page-title.php'; ?>

    <form id="add-task-form" method="post"
        action="../batch-add-function.php?sys_part=task"
        enctype="multipart/form-data" class="layui-form detail-box">



            <div class="layui-form-item">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-block">
                    <input type="text" name="ai_startdate" id="start_date" autocomplete="off" class="layui-input" class="laydate-icon" placeholder="请选择开始时间">
                </div>
            </div>


        <?
           $case_list=select_lines_all_items($table_Prefix."case","nid desc","","0");
    
            $_unit_nid=transform_2darray_in_1darray_number_as_key($case_list,"unit");
            $_unit_nid_str=implode("','",$_unit_nid);
            $unit_list=select_lines_all_items($table_Prefix."unit","nid desc","nid in ('$_unit_nid_str')","0");
            $unit_name_list=transform_2darray_in_1darray_with_new_key($unit_list,"nid","name");
 

            
        ?>

        <div class="layui-form-item">
            <label class="layui-form-label">项目</label>
            <div class="layui-input-block">
                <select name="ai_case_id" lay-search="" lay-filter="case_id"  id="case_id">
                    <option value="">无</option>
                    <? for($i=0;$i<count($case_list);$i++){ ?>
                        <option value="<? echo $case_list[$i]['nid'] ?>">【<? echo $unit_name_list[$case_list[$i]['unit']] ?>】  : <? echo $case_list[$i]['name'] ?></option>
                    <? } ?>
                </select>
            </div>
        </div>

        <?

         $opportunity_list=select_lines_all_items($table_Prefix."opportunity","nid desc","","0");

         $_unit_nid=transform_2darray_in_1darray_number_as_key($opportunity_list,"unit_nid");
         $_unit_nid_str=implode("','",$_unit_nid);
         $unit_list=select_lines_all_items($table_Prefix."unit","nid desc","nid in ('$_unit_nid_str')","0");
         $unit_name_list=transform_2darray_in_1darray_with_new_key($unit_list,"nid","name");



        ?>

        <div class="layui-form-item">
            <label class="layui-form-label">商机</label>
            <div class="layui-input-block">
                <select name="ai_opportunity_nid" lay-search="" lay-filter="opportunity_nid" id="opportunity_nid" >
                    <option value="">无</option>
                    <? for($i=0;$i<count($opportunity_list);$i++){ ?>
                        <option value="<? echo $opportunity_list[$i]['nid'] ?>"><? echo $unit_name_list[$opportunity_list[$i]['unit_nid']] ?> : <? echo $opportunity_list[$i]['case_type'] ?></option>
                    <? } ?>
                </select>
            </div>
        </div>

            <!-- <div class="layui-form-item">
                <label class="layui-form-label">凭证</label>
                <div class="layui-input-block">
                    <textarea id="ai_voucher" name="ai_voucher" cols="100"></textarea>
                </div>
            </div> -->




        <input name="themes_id" type="hidden" value="<? echo  $_REQUEST['nid']; ?>"/>
        <input name="sys_part" type="hidden" value="<? echo $system_part ?>"/>
            <input name="nowpageid" type="hidden" value="<? echo $_REQUEST['nowpageid'] ?>"/>
            <input name="sortby" type="hidden" value="<? echo $_REQUEST['sortby'] ?>"/>

        <div class="function">
            <button class="layui-btn" lay-submit lay-filter="formTaskBtn" type="buttom" id="taskBtn">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </form>
</div>
<script type="application/javascript">
    layui.use('form', function(){
        var form = layui.form;

        form.on('select(case_id)', function(data){
            $("#opportunity_nid").val('');
           form.render('select');
        });
        form.on('select(opportunity_nid)', function(data){
            $("#case_id").val('');

            form.render('select');
        });
    });


</script>
</body>
<script src="../../asset/js/date.js?version=2023"></script>
</html>